home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / nameless.swf / scripts / DefineSprite_2130 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-06-09  |  676 b   |  32 lines

  1. if(!setVars)
  2. {
  3.    _visible = false;
  4.    var moveSpeed = 6;
  5.    var friction = 10;
  6.    var xTar = _X;
  7.    var setVars = true;
  8. }
  9. var onEnterFrame = function()
  10. {
  11.    if(_root.gameGo == true && _visible == true)
  12.    {
  13.       if(_root.pauseMode == false)
  14.       {
  15.          if(Key.isDown(37) && !_root.bound.hitTest(xTar - _width / 2 + 10,_Y,true))
  16.          {
  17.             xTar -= moveSpeed;
  18.          }
  19.          if(Key.isDown(39) && !_root.bound.hitTest(xTar + _width / 2 - 10,_Y,true))
  20.          {
  21.             xTar += moveSpeed;
  22.          }
  23.          _X = _X + (xTar - _X) / friction;
  24.          play();
  25.       }
  26.       else
  27.       {
  28.          stop();
  29.       }
  30.    }
  31. };
  32.